package com.cdp.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdp.common.core.domain.entity.SysFlyashFineness;
import com.cdp.common.core.domain.entity.SysSandFineness;
import com.cdp.common.core.domain.entity.SysStoneGrain;
import com.cdp.system.dto.SandFinenessDTO;
import com.cdp.system.dto.StoneGrainDTO;
import com.cdp.system.mapper.SysSandFinenessMapper;
import com.cdp.system.mapper.SysSandTypeMapper;
import com.cdp.system.service.ISysSandFinenesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ISysSandFinenesServiceImpl extends ServiceImpl<SysSandFinenessMapper, SysSandFineness> implements ISysSandFinenesService {


    @Autowired
    private  SysSandFinenessMapper sysSandFinenessMapper;
    @Autowired
    private com.cdp.common.mapper.SysStoneGrainMapper sysStoneGrainMapper;
    @Override
    public List<SysSandFineness> listSandFineness() {
        List<SysSandFineness> list = list();
        return list ;
    }

    @Override
    public List<SysSandFineness> listMistedSand(SandFinenessDTO sandFinenessDTO) {
        LambdaQueryWrapper<SysSandFineness> wrapper = new LambdaQueryWrapper<>();
        // 如果传入的 name 不为空
        if (sandFinenessDTO.getName() != null && !sandFinenessDTO.getName().isEmpty()) {
            wrapper.like(SysSandFineness::getName, sandFinenessDTO.getName());
        }

        // 执行查询
        return sysSandFinenessMapper.selectList(wrapper);
    }

    /**
     * 石颗粒模糊查询
     * @param stoneGrainDTO
     * @return
     */
    @Override
    public List<SysStoneGrain> listMistedStoneGrain(StoneGrainDTO stoneGrainDTO) {
        LambdaQueryWrapper<SysStoneGrain> wrapper = new LambdaQueryWrapper<>();
        // 如果传入的 name 不为空
        if (stoneGrainDTO.getName() != null && !stoneGrainDTO.getName().isEmpty()) {
            wrapper.like(SysStoneGrain::getName, stoneGrainDTO.getName());
        }

        // 执行查询
        return sysStoneGrainMapper.selectList(wrapper);
    }




}
